package com.fzg.controller;


import com.fzg.common.enums.ResponseWrapper;
import com.fzg.common.model.jobInfoManage.param.*;
import com.fzg.service.JobInforService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 求职信息表 前端控制器
 * </p>
 *
 * @author fzg
 * @since 2021-12-13
 */
@RestController
@RequestMapping("/jobInfoManage")
public class JobInforController {

    @Autowired
    private JobInforService jobInforService;

    /**
     * 获取求职信息列表
     */
    @GetMapping("/getjobInfoList")
    public ResponseWrapper getJobInfoList(@Validated GetJobInfoListParam param){
        return jobInforService.getJobInfoList(param);
    }

    /**
     * 判断求职用户是否存在
     */
    @GetMapping("/checkHunterJobUserIsExist")
    public ResponseWrapper checkHunterJobUserIsExist(@Validated CheckHunterJobUserIsExistParam param){
        return jobInforService.checkHunterJobUserIsExist(param);
    }

    /**
     * 判断是否为管理员
     */
    @GetMapping("/isAdmin")
    public ResponseWrapper isAdmin(@Validated CheckIsAdminParam param){
        return jobInforService.isAdmin(param);
    }

    /**
     * 添加或者修改求职信息
     */
    @PostMapping("/editOrAddJobInfoApi")
    public ResponseWrapper editOrAddJobInfoApi(@Validated @RequestBody EditOrAddJobInfoParam param){
        return jobInforService.editOrAddJobInfoApi(param);
    }

    /**
     * 删除求职信息
     */
    @PostMapping("/delJobInfoByAid")
    public ResponseWrapper delJobInfoByAid(@Validated @RequestBody DelJobInfoByAidParam param){
        return jobInforService.delJobInfoByAid(param);
    }

    /**
     * 获取被点击用户的信息以及用户的求职信息
     */
    @GetMapping("/getUserInfoAndJobInfo")
    public ResponseWrapper getUserInfoAndJobInfo(@Validated GetUserInfoAndJobInfoParam param){
        return jobInforService.getUserInfoAndJobInfo(param);
    }

    /**
     * 得到全部求职者信息和求职者发布的求职信息
     */
    @GetMapping("/getAllHunterInfoAndHunterPublishInfo")
    public ResponseWrapper getAllHunterInfoAndHunterPublishInfo(GetAllHunterInfoAndHunterPublishInfoParam param){
        return jobInforService.getAllHunterInfoAndHunterPublishInfo(param);
    }

}
